home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-06 | 1.7 KB | 73 lines | [TEXT/ToyS] |
- --
- -- Check The Mail
- -- Copyright © 1994 Mark Alldritt
- --
- -- This simple script establishes a MacPPP connection, checks for new mail (and
- -- uploades queued mail), and finally shuts down the MacPPP connection.
- --
- -- Notes:
- --
- -- Requires MacPPP Control 1.1 or later and Eudora 1.4.2 or later
- --
- --
-
- try
- --
- -- Get Eudora started so we don't have to wait for it once we've started the PPP
- -- connection (time is money!).
- --
- tell application "Eudora" to launch
-
- --
- -- Establish a PPP connection to the Mail Server
- --
- openPPP
-
- --
- -- waste some time while the connection is established. This is needed because MacPPP
- -- operates asynchronously.
- --
- set i to 1
- repeat while (i < 100 and not (PPPopened)) -- may need to increase 100 on fast Macs
- set i to i + 1
- end repeat
- if not (PPPopened) then
- error "MacPPP connection not opened"
- end if
-
- --
- -- Send queued messages and check for new mail
- --
- with timeout of 9999 seconds
- tell application "Eudora"
- connect with Send and Check
- end tell
- end timeout
-
- --
- -- Shutdown the PPP connection
- --
- activate -- several activates are used to ensure the script is the foreground
- activate -- process to avoid problems with closePPP when its called from the
- activate -- background.
- activate
- closePPP
-
- on error errorString
- --
- -- Something went wrong. Let the user know, and offer to close the connection
- --
-
- activate
- if PPPopened then
- display dialog "Can't check the mail (" & errorString & ").
-
- Close MacPPP connection?" buttons {"Close", "Don't Close"} default button "Close" with icon caution
- if button returned of the result = "Close" then
- closePPP
- end if
- else
- display dialog "Can't check the mail (" & errorString & ¬
- ")." buttons "OK" default button "OK" with icon caution
- end if
- end try